﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Com.AAS.Common.Manager
{
    public class NoticeMananger
    {
        private static Object m_LockInstace = new object();
        private static NoticeMananger m_Instance;

        public static NoticeMananger Instance
        {
            get
            {
                if (m_Instance == null)
                {
                    lock (m_LockInstace)
                    {
                        if (m_Instance == null)
                        {
                            m_Instance = new NoticeMananger();
                        }
                    }
                }

                return m_Instance;
            }
        }

        private Object m_LockHandler = new object();
        private Dictionary<String, NoticeHandler> m_Handles;

        private NoticeMananger()
        {
            m_Handles = new Dictionary<string, NoticeHandler>();
        }

        public NoticeHandler Registor(String uuid)
        {
            if (m_Handles.ContainsKey(uuid))
                return m_Handles[uuid];
            else
            {
                lock (m_LockHandler)
                {
                    NoticeHandler handler = new NoticeHandler();
                    m_Handles.Add(uuid, handler);                  
                    return handler;
                }
            }
        }
    }
}